package com.example.springbootdemo.database;


import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class DataBaseConfig {
    String driverClass;
    String user;
    String password;
    String jdbcUrl;
    int maxPoolSize;
    int minPoolSize;
    int initialPoolSize;

    public DataBaseConfig() {
        Properties properties = new Properties();
        InputStream inputStream = null;
        try {
            inputStream = new FileInputStream("src/main/resources/application.properties");
            properties.load(inputStream);
            driverClass = properties.getProperty("c3p0.driverClass");
            user = properties.getProperty("c3p0.user");

            password = properties.getProperty("c3p0.password");
            jdbcUrl = properties.getProperty("c3p0.jdbcUrl");
            maxPoolSize = Integer.parseInt(properties.getProperty("c3p0.maxPoolSize"));
            minPoolSize = Integer.parseInt(properties.getProperty("c3p0.minPoolSize"));
            initialPoolSize = Integer.parseInt(properties.getProperty("c3p0.initialPoolSize"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
